﻿<% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Submit</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<%
    Dim Lang, Form, Email, Result, Reply
    Lang = "chis"
    Email = Request.Form("email")
    Result = sendMail(getMailBody("SUBMIT", Lang), getMessage("APPLY_SUBJECT", Lang), "webmaster@macao.communications.museum", "info@macao.communications.museum")
    'Result = sendMail(getMailBody("SUBMIT", Lang), getMessage("APPLY_SUBJECT", Lang), "webmaster@macao.communications.museum", "shlei@macaupost.gov.mo")
    If email <> "" Then
        Reply = sendMail(getMailBody("REPLY", Lang), getMessage("REPLY_SUBJECT", Lang), "info@macao.communications.museum", Email)
    End If
    getRedirect(Lang)
%>
</body>
</html>

<%
Function getMailBody(Method,Lang)
    Dim TopicArr, TopicStr, TopicLen, m
    TopicStr = ""
    TopicArr = Split(Request.Form("topic"),",")
    TopicLen = UBound(TopicArr)
    Response.CharSet = "utf-8"
    m = "<html xmlns='http://www.w3.org/1999/xhtml'>"
    m = m & "<head>"
    m = m & "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>"
    m = m & "<title></title>"
    m = m & "</head>"
    m = m & "<body>"
    Select Case Method
        Case "SUBMIT"
            m = m & "<h4>" & getMessage("INDIVIDUAL_APPLY", Lang) & "</h4>"
            m = m & "<table border='1'>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_TOPIC", Lang) & "</th><td>" & Request.Form("topic") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_NAME", Lang) & "</th><td>" & Request.Form("name") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_CLASS", Lang) & "</th><td>" & Request.Form("iclass") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_ENTITY", Lang) & "</th><td>" & Request.Form("entity") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_AGE", Lang) & "</th><td>" & Request.Form("age") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_PARENT", Lang) & "</th><td>" & Request.Form("parent") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_TEL", Lang) & "</th><td>" & Request.Form("tel") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_ADDRESS", Lang) & "</th><td>" & Request("address") & "</td></tr>"
            m = m & "<tr><th style='text-align: right'>" & getMessage("NAME_EMAIL", Lang) & "</th><td>" & Request.Form("email") & "</td></tr>"
            m = m & "</table>"
            If Request.Form("inform") = "yes" Then
                m = m & "<p>" & getMessage("ENABLE_RECEIVE_INFORM", Lang) & "</p>"
            Else
                m = m & "<p>" & getMessage("DISABLE_RECEIVE_INFORM", Lang) & "</p>"
            End If
        Case "REPLY"
            m = m & "<p>" & getMessage("REPLY_BODY", Lang) & "</p>"
            m = m & "<ul>"
            For i = 0 To TopicLen
                m = m & "<li>" & getTopic(Trim(TopicArr(i)), Lang) & "</li>"
            Next
            m = m & "</ul>"
            m = m & "<p>" & getMessage("REPLY_FOOT", Lang) & "</p>"
    End Select
    m = m & "</body>"
    m = m & "</html>"
    getMailBody = m
End Function

function sendMail(HtmlBody, Subject, FromAddress, ToAddress)
  dim myMail
  set myMail = CreateObject("CDO.Message")
  myMail.Subject = Subject  
  'if FromAddress="" Then
	'FromAddress = Chr(34) & Request.Form("email") & Chr(34) & " <shlei@macaupost.gov.mo>"
  'End If
  'if Request.Form("email")<>"" then
     ' myMail.Fields.Item("urn:schemas:mailheader:Reply-To")=Request.Form("email")
     'myMail.ReplyTo=Request.Form("email")
  'end if
  myMail.From = FromAddress 
  myMail.BodyPart.CharSet = "utf-8"
  myMail.To = ToAddress
  'MyMail.Bcc="webmaster@macao.communications.museum"
  myMail.HtmlBody = HtmlBody
  myMail.HTMLBodyPart.Charset = "utf-8"
  'For local test 
  'myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.10.12"
  'For Web host
  myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.215.186"
  myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
  'myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  'myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "info@macao.communications.museum"
  'myMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "info0621"
  myMail.Configuration.Fields.Update
  myMail.Send

  Set myMail=Nothing
  SendMail=True
end function

Function getTopic(Num, Lang)
    getTopic = ""
    Select Case Num
        Case "10-V41"
            Select Case Lang
                Case "chi"
                    getTopic = "01/05/2010 (10-V41)探索人體奧秘－生物醫學工程，咪話唔關你事！"
                Case "chis"
                    getTopic = "01/05/2010 (10-V41)探索人体奥秘－生物医学工程，咪话唔关你事！"
                Case "por"
                    getTopic = "01/05/2010 (10-V41)Encontra os Segredos do Nosso Corpo através de Engenharia Biomédica"
                Case "eng"
                    getTopic = "01/05/2010 (10-V41)Explore the Secret of Human Body through Biomedical Engineering"
            End Select
        Case "10-V42"
            Select Case Lang
                Case "chi"
                    getTopic = "15/05/2010 (10-V42)電力電子－生活、環保、中學課程與你"
                Case "chis"
                    getTopic = "15/05/2010 (10-V42)电力电子－生活、环保、中学课程与你"
                Case "por"
                    getTopic = "15/05/2010 (10-V42)Electricidade e Electrónica na Nossa Vida Quotidiana, no Meio Ambiente e no Currículo Escolar"
                Case "eng"
                    getTopic = "15/05/2010 (10-V42)Electricity &#38; Electronics - Daily Life, Environment and Study in Secondary School"
            End Select
        Case "10-V43"
            Select Case Lang
                Case "chi"
                    getTopic = "05/06/2010 (10-V43)微電子集成電路技術及其在澳門的發展"
                Case "chis"
                    getTopic = "05/06/2010 (10-V43)微电子集成电路技术及其在澳门的发展"
                Case "por"
                    getTopic = "05/06/2010 (10-V43)Desenvolvimento e Tecnologias de Circuitos Integrados Micro-electrónicos em Macau"
                Case "eng"
                    getTopic = "05/06/2010 (10-V43)Development and Technology of Micro-electronic Integrated Circuits in Macao"
            End Select
        Case "10-V44"
            Select Case Lang
                Case "chi"
                    getTopic = "19/06/2010 (10-V44)從光纖到九十後的無線電玩"
                Case "chis"
                    getTopic = "19/06/2010 (10-V44)从光纤到九十后的无线电玩"
                Case "por"
                    getTopic = "19/06/2010 (10-V44)De Fibras Ópticas a Brinquedos Rádio-electrónicos nos anos 90"
                Case "eng"
                    getTopic = "19/06/2010 (10-V44)When the Trail of the Technological Development of Fiber Optics Leads to the Radio Play of Post-1990 Generation, Then and Now"
            End Select
        Case "10-V45"
            Select Case Lang
                Case "chi"
                    getTopic = "26/06/2010 (10-V45)3D電腦圖形世界－工程與藝術的結合"
                Case "chis"
                    getTopic = "26/06/2010 (10-V45)3D计算机图形世界－工程与艺术的结合"
                Case "por"
                    getTopic = "26/06/2010 (10-V45)O Mundo Informático de Gráficos em 3 Dimensões - Combinação de Engenharia e Arte"
                Case "eng"
                    getTopic = "26/06/2010 (10-V45)The Graphic World of 3-Dimension – Combining Engineering and Art"
            End Select
    End Select
End Function

Function getRedirect(Lang)
    Select Case Lang
        Case "chi"
            Response.Redirect("/chi/news/special/2010seminar/thank.html")
        Case "chis"
            Response.Redirect("/chis/news/special/2010seminar/thank.html")
        Case "por"
            Response.Redirect("/por/news/special/2010seminar/thank.html")
        Case "eng"
            Response.Redirect("/eng/news/special/2010seminar/thank.html")
    End Select
End Function

Function getMessage(Desc, Lang)
    getMessage = ""
    Select Case Desc
        Case "APPLY_SUBJECT"
            Select Case Lang
                Case "chi"
                    getMessage = "2010科普講座申請表"
                Case "chis"
                    getMessage = "2010科普讲座申请表"
                Case "por"
                    getMessage = "Boletim de Inscrição - Seminários de Ciência Popular 2010 "
                Case "eng"
                    getMessage = "Application Form for Science Seminar 2010"
            End Select
        Case "INDIVIDUAL_APPLY"
            Select Case Lang
                Case "chi"
                    getMessage = "個人報名"
                Case "chis"
                    getMessage = "个人报名"
                Case "por"
                    getMessage = "Inscrição Individual"
                Case "eng"
                    getMessage = "Individual Application"
            End Select
        Case "GROUP_APPLY"
            Select Case Lang
                Case "chi"
                    getMessage = "集體報名"
                Case "chis"
                    getMessage = "集体报名"
                Case "por"
                    getMessage = "Inscrição em Grupo"
                Case "eng"
                    getMessage = "Group Application"
            End Select
        Case "ENABLE_RECEIVE_INFORM"
            Select Case Lang
                Case "chi"
                    getMessage = "本人<b>願意</b>在日後收到通訊博物館的服務或活動宣傳通知。"
                Case "chis"
                    getMessage = "本人<b>愿意</b>在日后收到通讯博物馆的服务或活动宣传通知。"
                Case "por"
                    getMessage = "Requerente <b>quer</b> receber informação promocional do Museu das Comunicações."
                Case "eng"
                    getMessage = "Applicant <b>wants</b> to receive promotional information from Communications Museum."
            End Select
        Case "DISABLE_RECEIVE_INFORM"
            Select Case Lang
                Case "chi"
                    getMessage = "本人<b>不願意</b>在日後收到通訊博物館的服務或活動宣傳通知。"
                Case "chis"
                    getMessage = "本人<b>不愿意</b>在日后收到通讯博物馆的服务或活动宣传通知。"
                Case "por"
                    getMessage = "Requerente <b>não quer</b> receber informação promocional do Museu das Comunicações."
                Case "eng"
                    getMessage = "Applicant <b>does not want</b> to receive promotional information from Communications Museum."
            End Select
        Case "NAME_TOPIC"
            Select Case Lang
                Case "chi"
                    getMessage = "所報名的講座: "
                Case "chis"
                    getMessage = "所报名的讲座: "
                Case "por"
                    getMessage = "Palestra a participar: "
                Case "eng"
                    getMessage = "Apply for Topic: "
            End Select
        Case "NAME_NAME"
            Select Case Lang
                Case "chi"
                    getMessage = "姓名: "
                Case "chis"
                    getMessage = "姓名: "
                Case "por"
                    getMessage = "Nome: "
                Case "eng"
                    getMessage = "Name: "
            End Select
        Case "NAME_CONTACT"
            Select Case Lang
                Case "chi"
                    getMessage = "教師/聯絡人: "
                Case "chis"
                    getMessage = "教师/联络人: "
                Case "por"
                    getMessage = "Contacto: "
                Case "eng"
                    getMessage = "Contact Person: "
            End Select    
        Case "NAME_CLASS"
            Select Case Lang
                Case "chi"
                    getMessage = "年級: "
                Case "chis"
                    getMessage = "年级: "
                Case "por"
                    getMessage = "Nível: "
                Case "eng"
                    getMessage = "Class: "
            End Select
        Case "NAME_ENTITY"
            Select Case Lang
                Case "chi"
                    getMessage = "學校/機構: "
                Case "chis"
                    getMessage = "学校/机构: "
                Case "por"
                    getMessage = "Escola/Entidade: "
                Case "eng"
                    getMessage = "School/Entity: "
            End Select
        Case "NAME_AGE"
            Select Case Lang
                Case "chi"
                    getMessage = "年齡: "
                Case "chis"
                    getMessage = "年龄: "
                Case "por"
                    getMessage = "Idade: "
                Case "eng"
                    getMessage = "Age: "
            End Select
        Case "NAME_PARENT"
            Select Case Lang
                Case "chi"
                    getMessage = "家長姓名: "
                Case "chis"
                    getMessage = "家长姓名: "
                Case "por"
                    getMessage = "Filação: "
                Case "eng"
                    getMessage = "Parent’s Name: "
            End Select
        Case "NAME_TEL"
            Select Case Lang
                Case "chi"
                    getMessage = "電話: "
                Case "chis"
                    getMessage = "电话: "
                Case "por"
                    getMessage = "Tel: "
                Case "eng"
                    getMessage = "Tel: "
            End Select
        Case "NAME_ADDRESS"
            Select Case Lang
                Case "chi"
                    getMessage = "地址: "
                Case "chis"
                    getMessage = "地址: "
                Case "por"
                    getMessage = "Morada: "
                Case "eng"
                    getMessage = "Address: "
            End Select
        Case "NAME_EMAIL"
            Select Case Lang
                Case "chi"
                    getMessage = "電郵: "
                Case "chis"
                    getMessage = "电邮: "
                Case "por"
                    getMessage = "Email: "
                Case "eng"
                    getMessage = "Email: "
            End Select
        Case "REPLY_SUBJECT"
            Select Case Lang
                Case "chi"
                    getMessage = "2010科普講座"
                Case "chis"
                    getMessage = "2010科普讲座"
                Case "por"
                    getMessage = "Seminários de Ciência Popular 2010 "
                Case "eng"
                    getMessage = "Science Seminar 2010"
            End Select    
        Case "REPLY_BODY"
            Select Case Lang
                Case "chi"
                    getMessage = "我們已經收到您的報名表，請届時準時出席以下的講座，如有任何問題可與我們聯絡，多謝您的報名。"
                Case "chis"
                    getMessage = "我们已经收到您的报名表，请届时准时出席以下的讲座，如有任何问题可与我们联络，多谢您的报名。"
                Case "por"
                    getMessage = "Foi recebida a sua ficha de inscrição. É favor de participar pontualmente nas palestras escolhidas. Muito obrigado."
                Case "eng"
                    getMessage = "We have received your application. Please attend the following talks on time. If you have any question, please contact us. Thank you."
            End Select
        Case "REPLY_FOOT"
            Select Case Lang
                Case "chi"
                    getMessage = "通訊博物館<br />Tel:2871 8063<br />Email: info@macao.communications.museum"
                Case "chis"
                    getMessage = "通讯博物馆<br />Tel:2871 8063<br />Email: info@macao.communications.museum"
                Case "por"
                    getMessage = "Museu das Comunicações<br />Tel: 28718063 28718570<br />Email: info@macao.communications.museum"
                Case "eng"
                    getMessage = "Communications Museum<br />Tel: 28718063 28718570<br />Email: info@macao.communications.museum"
            End Select    
    End Select
End Function
 %>